using System;
using System.Collections.Generic;
using System.Text;
using Dune.Business.Domain.Users;
using Edge.Business.Security;
using Edge.Common.Services;
using Edge.Business.Entities;

namespace Dune.Business.Domain.Content
{
    /// <summary>
    /// Users object for NHibernate mapped table 'entity_log'.
    /// </summary>
    [Serializable]
    public class EntityLog : BaseEntity<int>
    {
        private string name;
        private int entityId;
        private string propertyName;
        private string previousState;
        private string currentState;
        private Person  createdBy;
        private DateTime createDate;

        public virtual string Name
        {
            get { return name; }
            set { name = value; }
        }

        public virtual int EntityId
        {
            get { return entityId; }
            set { entityId = value; }
        }

        public virtual string PropertyName
        {
            get { return propertyName; }
            set { propertyName = value; }
        }

        public virtual string PreviousState
        {
            get { return previousState; }
            set { previousState = value; }
        }

        public virtual string CurrentState
        {
            get { return currentState; }
            set { currentState = value; }
        }

        public virtual Person CreatedBy
        {
            get { return createdBy; }
            set { createdBy = value; }
        }

        public virtual DateTime CreateDate
        {
            get { return createDate; }
            set { createDate = value; }
        }

        public EntityLog()
        {
        }

        public EntityLog(string name, int entityId, string propretyName, string previousState, string currentState)
        {
            this.name = name;
            this.entityId = entityId;
            this.propertyName = propretyName;
            this.previousState = previousState;
            this.currentState = currentState;
            this.createdBy = Locator.GetService<IPersonManager<Person>>().GetCurrentAuthor();
            this.createDate = DateTime.Now;
        }
    }
}
